#include"halton.h"
float halton(const int b, long long j)
{
	int p = primes[b];
	float h = 0.0f;
	float f = 1.0f / p;
	float fct = f;
	while (j > 0)
	{
		h += rev(j % p, p) * fct;
		j /= p;
		fct *= f;
	}
	return h;
}